﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Client
{
    public partial class OptionForm : System.Windows.Forms.Form
    {
        public OptionForm()
        {
            InitializeComponent();
            LoadOptionData();
        }

        private void LoadOptionData()
        {
            // 자동실행
            if ((bool)RegistryAdmin.GetRegistryKey(RegistryAdmin.KEY_NAME.AUTOSTART) == true)
            {
                cbAutoStart.Checked = true;
            }

            // 자동로그인
            if ((bool)RegistryAdmin.GetRegistryKey(RegistryAdmin.KEY_NAME.SAVE_ID) == true)
            {
                cbAutoLogin.Checked = true;
            }

        }

        // 옵션 설정, 저장.
        private void btnOK_Click(object sender, EventArgs e)
        {
            // Option Set-up
            if (cbAutoStart.Checked == true)
            {
                RegistryAdmin.AutoStartReg();
            }
            else
            {
                RegistryAdmin.AutoStartDel();
            }


            // Option Save


            // Close T.T
            this.Close();
        }

        // 취소 버튼을 눌렀을때, Form 을 닫음.
        private void btnCancle_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}
